from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
import warnings

warnings.filterwarnings('ignore')
import logging
logging.getLogger('modelscope').setLevel(logging.ERROR)

local_model_path = r'SentimentTwo/model/nlp_structbert_sentiment-classification_chinese-base'
semantic_cls = pipeline(Tasks.text_classification, model=local_model_path,device='cuda')

def get_emotion(text):
    return semantic_cls(input=text)
